#include "stdafx.h"
#include "DrawCilpRgn.h"

CDrawCilpRgn::CDrawCilpRgn(HDC hDC,const CRect &rcCilp)
	:m_dcDraw(hDC)
{
	m_RgnDraw.CreateRectRgnIndirect (&rcCilp);
	CDC::FromHandle(hDC)->SelectClipRgn (&m_RgnDraw);
}

CDrawCilpRgn::CDrawCilpRgn( HDC hDC, CRgn &rgnCilp )
	:m_dcDraw(hDC)
{
	m_RgnDraw.CreateRectRgnIndirect(&CRect(0,0,0,0));
	int  rCode= m_RgnDraw.CopyRgn(&rgnCilp);
	CDC::FromHandle(hDC)->SelectClipRgn (&m_RgnDraw);
}

CDrawCilpRgn::~CDrawCilpRgn(void)
{
	CDC::FromHandle(m_dcDraw)->SelectClipRgn (NULL);
	m_RgnDraw.DeleteObject();
}
